# class Person(object):
#     def __new__(cls, *args, **kwargs):
#         print("__new__方法执行")
#         return object.__new__(cls)
#
#     def __init__(self, name, age):
#         print("__init__方法执行")
#         self.name = name
#         self.age = age
#
# yuan = Person("yuan", 18)
# print(yuan)
# print(yuan.name)
# print(yuan.age)

class Config(object):
    instance = None

    def __new__(cls, *args, **kwargs):
        if not cls.instance:
            cls.instance = object.__new__(cls)
        return cls.instance

    def __init__(self):
        print("__init__执行了")

c1 = Config()
c2 = Config()

print(id(c1))
print(id(c2))